package com.yourenbang.lingyun.transaction.web.service.impl.pay.withdraw;

import com.yourenbang.lingyun.mapper.FundAccountMapper;
import com.yourenbang.lingyun.transaction.mapper.TransactionFundAccountChangePlanMapper;
import com.yourenbang.lingyun.transaction.mapper.TransactionFundAccountJournalMapper;
import com.yourenbang.lingyun.transaction.mapper.TransactionFundAccountMapper;
import com.yourenbang.lingyun.transaction.mapper.TransactionFundBillMapper;
import com.yourenbang.lingyun.transaction.web.service.pay.withdraw.WithdrawFundOptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//TODO 重要重构 关于资金的冻结、解冻、加减帐,退还逻辑; 对于提现,充值,加减帐操作是一样的,需要提取到一个统一的抽象类供上层调用
@Slf4j
@Service("fundWithdrawServiceOpt")
public class WithdrawFundOptServiceImpl implements WithdrawFundOptService {

    @Autowired
    private FundAccountMapper fundAccountMapper;
    @Autowired
    private TransactionFundAccountChangePlanMapper fundAccountChangePlanMapper;
    @Autowired
    private TransactionFundAccountMapper transactionFundAccountMapper;
    @Autowired
    private TransactionFundAccountJournalMapper fundAccountJournalMapper;
    @Autowired
    private TransactionFundBillMapper fundBillMapper;

//    @Transactional
//    @Override
//    public void balanceFundPayOpt(FundAccount sysAccount, FundAccount userAccount,
//                                  FundAccountChangePlan changePlan, FundPayBusDTO fundPayBusDTO) {
//
//        //可提现金额-;冻结中的金额+
//        int i = transactionFundAccountMapper.freeUserAcc(userAccount.getUserBaseId(), userAccount.getAccountType(), changePlan.getChangeAmount());
//        BizAssertUtils.assertOne(i, "更新用户账户失败");
//
//        //可提现金额-;冻结中的金额+
//        int ii = transactionFundAccountMapper.freeSysAcc(sysAccount.getAccountType(), changePlan.getChangeAmount());
//        BizAssertUtils.assertOne(ii, "更新系统提现账户失败");
//
//        FundAccountJournal journalUser = new FundAccountJournal(changePlan.getPlatNo());
//        journalUser.setChannelId(changePlan.getChannelId());
//        journalUser.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        journalUser.setFundAccountId(userAccount.getFundAccountId());
//        journalUser.setJournalStatus(JournalStatus.SUCCESS);
//        journalUser.setJournalChangeValue(changePlan.getChangeAmount());
//        journalUser.setAccountJournalAcid(changePlan.getOrderId());
//
//        journalUser.setAccountMainJournalType(fundPayBusDTO.getAccountMainJournalType());
//        journalUser.setAccountMainJournalTypeName(fundPayBusDTO.getAccountMainJournalTypeName());
//
//        journalUser.setAccountJournalType(changePlan.getAccountJournalType());
//        journalUser.setAccountJournalTypeName(
//                AccountJournalType.getAccountJournalTypeByFullCode(journalUser.getAccountJournalType()).getMsg()
//        );
//
//        journalUser.setAccountIncome(BigDecimal.ZERO);            //收入资金变动金额
//        journalUser.setAccountAmountFrozen(changePlan.getChangeAmount());   //冻结资金变动收入
//        journalUser.setAccountAmountWithdrawable(changePlan.getChangeAmount());    //可提现资金变动收入
//        journalUser.setAccountAmountWithdrawed(BigDecimal.ZERO);  //已提现资金变动收入
//        journalUser.setAccountAmountUndepositable(BigDecimal.ZERO);   //不可提现资金变动收入
//
//        journalUser.setAccountIncomeBefore(userAccount.getAccountIncome());      //收入变动前的金额
//        journalUser.setAccountIncomeAfterwards(userAccount.getAccountIncome());  //收入变动后的金额
//
//        journalUser.setAccountAmountFrozenBefore(userAccount.getAccountAmountFrozen());   //冻结资金变化前金额
//        journalUser.setAccountAmountFrozenAfterwards(userAccount.getAccountAmountFrozen().add(changePlan.getChangeAmount())); //冻结资金变化后金额
//
//        journalUser.setAccountAmountWithdrawableBefore(userAccount.getAccountAmountWithdrawable());   //可提现金额变化前金额
//        journalUser.setAccountAmountWithdrawableAfterwards(userAccount.getAccountAmountWithdrawable().subtract(changePlan.getChangeAmount())); //可提现金额变化后金额
//
//        journalUser.setAccountAmountWithdrawedBefore(userAccount.getAccountAmountWithdrawed());        //已提现金额变化前金额
//        journalUser.setAccountAmountWithdrawedAfterwards(userAccount.getAccountAmountWithdrawed());    //已提现金额变化后金额
//
//        journalUser.setAccountAmountUndepositableBefore(userAccount.getAccountAmountUndepositable());     //不可提现金额变化前金额
//        journalUser.setAccountAmountUndepositableAfterwards(userAccount.getAccountAmountUndepositable()); //不可提现金额变化后金额
//
//        int y = fundAccountJournalMapper.insert(journalUser);
//        BizAssertUtils.assertOne(y, "添加提现流水失败");
//
//
//        FundAccountJournal journalSys = new FundAccountJournal(changePlan.getPlatNo());
//        journalSys.setChannelId(changePlan.getChannelId());
//        journalSys.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        journalSys.setFundAccountId(sysAccount.getFundAccountId());
//        journalSys.setJournalStatus(JournalStatus.SUCCESS);
//        journalSys.setJournalChangeValue(changePlan.getChangeAmount());
//        journalSys.setAccountJournalAcid(changePlan.getOrderId());
//
//        journalSys.setAccountMainJournalType(fundPayBusDTO.getAccountMainJournalType());
//        journalSys.setAccountMainJournalTypeName(fundPayBusDTO.getAccountMainJournalTypeName());
//
//        journalSys.setAccountJournalType(changePlan.getFromAccountJournalType());
//        journalSys.setAccountJournalTypeName(
//                AccountJournalType.getAccountJournalTypeByFullCode(journalSys.getAccountJournalType()).getMsg()
//        );
//
//        journalSys.setAccountIncome(BigDecimal.ZERO);            //收入资金变动金额
//        journalSys.setAccountAmountFrozen(changePlan.getChangeAmount());   //冻结资金变动收入
//        journalSys.setAccountAmountWithdrawable(changePlan.getChangeAmount());    //可提现资金变动收入
//        journalSys.setAccountAmountWithdrawed(BigDecimal.ZERO);  //已提现资金变动收入
//        journalSys.setAccountAmountUndepositable(BigDecimal.ZERO);   //不可提现资金变动收入
//
//        journalSys.setAccountIncomeBefore(sysAccount.getAccountIncome());      //收入变动前的金额
//        journalSys.setAccountIncomeAfterwards(sysAccount.getAccountIncome());  //收入变动后的金额
//
//        journalSys.setAccountAmountFrozenBefore(sysAccount.getAccountAmountFrozen());   //冻结资金变化前金额
//        journalSys.setAccountAmountFrozenAfterwards(sysAccount.getAccountAmountFrozen().add(changePlan.getChangeAmount())); //冻结资金变化后金额
//
//        journalSys.setAccountAmountWithdrawableBefore(sysAccount.getAccountAmountWithdrawable());   //可提现金额变化前金额
//        journalSys.setAccountAmountWithdrawableAfterwards(sysAccount.getAccountAmountWithdrawable().subtract(changePlan.getChangeAmount())); //可提现金额变化后金额
//
//        journalSys.setAccountAmountWithdrawedBefore(sysAccount.getAccountAmountWithdrawed());        //已提现金额变化前金额
//        journalSys.setAccountAmountWithdrawedAfterwards(sysAccount.getAccountAmountWithdrawed());    //已提现金额变化后金额
//
//        journalSys.setAccountAmountUndepositableBefore(sysAccount.getAccountAmountUndepositable());     //不可提现金额变化前金额
//        journalSys.setAccountAmountUndepositableAfterwards(sysAccount.getAccountAmountUndepositable()); //不可提现金额变化后金额
//
//        int inJournalSysSize = fundAccountJournalMapper.insert(journalSys);
//        BizAssertUtils.assertOne(inJournalSysSize, "添加提现流水失败");
//
//    }

    /**
     * 归还冻结金额 事务
     */
//    @Transactional
//    @Override
//    public void returnFundOpt(FundAccountChangePlan changePlan) {
//
//        //判断重复归还
//        int readyreturnFund = fundBillMapper.countReadyreturnFund(changePlan.getPlatNo(), changePlan.getOrderId());
//        if (readyreturnFund > 0) {
//            KLog.warn("【提现】归还冻结金额, 已归还, 无需重复归还, 资金变动记录:{}", changePlan.toString());
//            throw new BizRuntimeException(BizCodeMessages.UNKNOWN_ERROR, "冻结金额已归还,无需重复归还");
//        }
//
//        //资金发起账户
//        FundAccount fromFundAccount = fundAccountMapper.selectByPrimaryKey(changePlan.getFundAccountId());
//        if (fromFundAccount == null) {
//            throw new BizRuntimeException(BizCodeMessages.UNKNOWN_ERROR, "系统账户不存在");
//        }
//
//        //资金接收账户
//        FundAccount toFundAccount = fundAccountMapper.selectByPrimaryKey(changePlan.getToFundAccountId());
//        if (toFundAccount == null) {
//            throw new BizRuntimeException(BizCodeMessages.UNKNOWN_ERROR, "用户账户不存在");
//        }
//
//        //可提现金额+;冻结中的金额-
//        int i = transactionFundAccountMapper.unFreeUserAcc(toFundAccount.getUserBaseId(),
//                toFundAccount.getAccountType(), changePlan.getChangeAmount());
//        BizAssertUtils.assertOne(i, "资金接收方金额解冻失败");
//
//        //可提现金额+;冻结中的金额-
//        int y = transactionFundAccountMapper.unFreeSysAcc(fromFundAccount.getAccountType(), changePlan.getChangeAmount());
//        BizAssertUtils.assertOne(y, "资金发起方金额解冻失败");
//
//        //变动成功
//        FundAccountChangePlan upChange = new FundAccountChangePlan(changePlan.getPlatNo());
//        upChange.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        upChange.setAccountChangePlanStatus(ChangePlanStatus.CHANGED);
//        int upChangeCount = fundAccountChangePlanMapper.updateById(upChange);
//        BizAssertUtils.assertOne(upChangeCount, "更新资金变动表失败");
//
//
//        //资金接收方流水记录
//        FundAccountJournal journalUser = new FundAccountJournal(changePlan.getPlatNo());
//        journalUser.setChannelId(changePlan.getChannelId());
//        journalUser.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        journalUser.setFundAccountId(toFundAccount.getFundAccountId());
//        journalUser.setJournalStatus(JournalStatus.SUCCESS);
//        journalUser.setJournalChangeValue(changePlan.getChangeAmount());
//        journalUser.setAccountJournalAcid(changePlan.getOrderId());
//
//        journalUser.setAccountMainJournalType(changePlan.getAccountMainJournalType());
//        journalUser.setAccountMainJournalTypeName(
//                AccountMainJournalType.getMainJournalTypeByCode(journalUser.getAccountMainJournalType()).getName()
//        );
//
//        journalUser.setAccountJournalType(changePlan.getAccountJournalType());
//        journalUser.setAccountJournalTypeName(
//                AccountJournalType.getAccountJournalTypeByFullCode(journalUser.getAccountJournalType()).getMsg()
//        );
//
//        journalUser.setAccountIncome(BigDecimal.ZERO);            //收入资金变动金额
//        journalUser.setAccountAmountFrozen(changePlan.getChangeAmount());   //冻结资金变动收入
//        journalUser.setAccountAmountWithdrawable(changePlan.getChangeAmount());    //可提现资金变动收入
//        journalUser.setAccountAmountWithdrawed(BigDecimal.ZERO);  //已提现资金变动收入
//        journalUser.setAccountAmountUndepositable(BigDecimal.ZERO);   //不可提现资金变动收入
//
//        journalUser.setAccountIncomeBefore(toFundAccount.getAccountIncome());      //收入变动前的金额
//        journalUser.setAccountIncomeAfterwards(toFundAccount.getAccountIncome());  //收入变动后的金额
//
//        journalUser.setAccountAmountFrozenBefore(toFundAccount.getAccountAmountFrozen());   //冻结资金变化前金额
//        journalUser.setAccountAmountFrozenAfterwards(toFundAccount.getAccountAmountFrozen().subtract(changePlan.getChangeAmount())); //冻结资金变化后金额
//
//        journalUser.setAccountAmountWithdrawableBefore(toFundAccount.getAccountAmountWithdrawable());   //可提现金额变化前金额
//        journalUser.setAccountAmountWithdrawableAfterwards(toFundAccount.getAccountAmountWithdrawable().add(changePlan.getChangeAmount())); //可提现金额变化后金额
//
//        journalUser.setAccountAmountWithdrawedBefore(toFundAccount.getAccountAmountWithdrawed());        //已提现金额变化前金额
//        journalUser.setAccountAmountWithdrawedAfterwards(toFundAccount.getAccountAmountWithdrawed());    //已提现金额变化后金额
//
//        journalUser.setAccountAmountUndepositableBefore(toFundAccount.getAccountAmountUndepositable());     //不可提现金额变化前金额
//        journalUser.setAccountAmountUndepositableAfterwards(toFundAccount.getAccountAmountUndepositable()); //不可提现金额变化后金额
//
//
//        int ii = fundAccountJournalMapper.insert(journalUser);
//        BizAssertUtils.assertOne(ii, "添加提现流水失败");
//
//
//        FundAccountJournal journalSys = new FundAccountJournal(changePlan.getPlatNo());
//        journalSys.setChannelId(changePlan.getChannelId());
//        journalSys.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        journalSys.setFundAccountId(fromFundAccount.getFundAccountId());
//        journalSys.setJournalStatus(JournalStatus.SUCCESS);
//        journalSys.setJournalChangeValue(changePlan.getChangeAmount());
//        journalSys.setAccountJournalAcid(changePlan.getOrderId());
//
//        journalSys.setAccountMainJournalType(changePlan.getAccountMainJournalType());
//        journalSys.setAccountMainJournalTypeName(
//                AccountMainJournalType.getMainJournalTypeByCode(journalUser.getAccountMainJournalType()).getName()
//        );
//
//        journalSys.setAccountJournalType(changePlan.getFromAccountJournalType());
//        journalSys.setAccountJournalTypeName(
//                AccountJournalType.getAccountJournalTypeByFullCode(journalSys.getAccountJournalType()).getMsg()
//        );
//
//        journalSys.setAccountIncome(BigDecimal.ZERO);            //收入资金变动金额
//        journalSys.setAccountAmountFrozen(changePlan.getChangeAmount());   //冻结资金变动收入
//        journalSys.setAccountAmountWithdrawable(changePlan.getChangeAmount());    //可提现资金变动收入
//        journalSys.setAccountAmountWithdrawed(BigDecimal.ZERO);  //已提现资金变动收入
//        journalSys.setAccountAmountUndepositable(BigDecimal.ZERO);   //不可提现资金变动收入
//
//        journalSys.setAccountIncomeBefore(fromFundAccount.getAccountIncome());      //收入变动前的金额
//        journalSys.setAccountIncomeAfterwards(fromFundAccount.getAccountIncome());  //收入变动后的金额
//
//        journalSys.setAccountAmountFrozenBefore(fromFundAccount.getAccountAmountFrozen());   //冻结资金变化前金额
//        journalSys.setAccountAmountFrozenAfterwards(fromFundAccount.getAccountAmountFrozen().subtract(changePlan.getChangeAmount())); //冻结资金变化后金额
//
//        journalSys.setAccountAmountWithdrawableBefore(fromFundAccount.getAccountAmountWithdrawable());   //可提现金额变化前金额
//        journalSys.setAccountAmountWithdrawableAfterwards(fromFundAccount.getAccountAmountWithdrawable().add(changePlan.getChangeAmount())); //可提现金额变化后金额
//
//        journalSys.setAccountAmountWithdrawedBefore(fromFundAccount.getAccountAmountWithdrawed());        //已提现金额变化前金额
//        journalSys.setAccountAmountWithdrawedAfterwards(fromFundAccount.getAccountAmountWithdrawed());    //已提现金额变化后金额
//
//        journalSys.setAccountAmountUndepositableBefore(fromFundAccount.getAccountAmountUndepositable());     //不可提现金额变化前金额
//        journalSys.setAccountAmountUndepositableAfterwards(fromFundAccount.getAccountAmountUndepositable()); //不可提现金额变化后金额
//
//
//        int inJournalSysSize = fundAccountJournalMapper.insert(journalSys);
//        BizAssertUtils.assertOne(inJournalSysSize, "添加提现流水失败");
//    }

    /**
     * 扣掉冻结金额 事务
     */
//    @Transactional
//    @Override
//    public void depositAwardPayQuerySuccOpt(FundAccountChangePlan changePlan) {
//
//        if (changePlan.getAccountChangePlanStatus().equals(ChangePlanStatus.CHANGED)) {
//            KLog.warn("【提现】扣掉冻结金额, 已扣除, 无需重复扣除, 资金变动记录:{}", changePlan.toString());
//            throw new UserBizException(BizCodeMessages.UNKNOWN_ERROR, "冻结金额已归还,无需重复归还");
//        }
//
//        //通易付系统支付宝押金提现账户
//        FundAccount fundAccount = fundAccountMapper.selectByPrimaryKey(changePlan.getFundAccountId());
//        if (Objects.isNull(fundAccount)) {
//            throw new BizRuntimeException(BizCodeMessages.UNKNOWN_ERROR, "系统账户不存在");
//        }
//
//        //用户账户
//        FundAccount userAccount = fundAccountMapper.selectByPrimaryKey(changePlan.getToFundAccountId());
//        if (Objects.isNull(userAccount)) {
//            throw new BizRuntimeException(BizCodeMessages.UNKNOWN_ERROR, "用户账户不存在");
//        }
//
//        //冻结中的金额-;已提现金额+
//        int upUserAccSize = transactionFundAccountMapper.subtractUnFreeUserAcc(userAccount.getUserBaseId(),
//                userAccount.getAccountType(), changePlan.getChangeAmount());
//        BizAssertUtils.assertOne(upUserAccSize, "解冻用户金额失败");
//
//        //冻结中的金额-;已提现金额+
//        int up30300111Size = transactionFundAccountMapper.subtractUnFreeSysAcc(fundAccount.getAccountType(),
//                changePlan.getChangeAmount());
//        BizAssertUtils.assertOne(up30300111Size, "解冻系统账户金额失败");
//
//        //变动成功
//        FundAccountChangePlan upChange = new FundAccountChangePlan(changePlan.getPlatNo());
//        upChange.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        upChange.setAccountChangePlanStatus(ChangePlanStatus.CHANGED);
//        int upChangeCount = fundAccountChangePlanMapper.updateById(upChange);
//        BizAssertUtils.assertOne(upChangeCount, "更新资金变动表失败");
//
//        //记录接收资金方流水
//        FundAccountJournal journalUser = new FundAccountJournal(changePlan.getPlatNo());
//        journalUser.setChannelId(changePlan.getChannelId());
//        journalUser.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        journalUser.setFundAccountId(userAccount.getFundAccountId());
//        journalUser.setJournalStatus(JournalStatus.SUCCESS);
//        journalUser.setJournalChangeValue(changePlan.getChangeAmount());
//        journalUser.setAccountJournalAcid(changePlan.getOrderId());
//
//        journalUser.setAccountMainJournalType(changePlan.getAccountMainJournalType());
//        journalUser.setAccountMainJournalTypeName(
//                AccountMainJournalType.getMainJournalTypeByCode(journalUser.getAccountMainJournalType()).getName()
//        );
//
//        journalUser.setAccountJournalType(changePlan.getAccountJournalType());
//        journalUser.setAccountJournalTypeName(
//                AccountJournalType.getAccountJournalTypeByFullCode(journalUser.getAccountJournalType()).getMsg()
//        );
//
//        journalUser.setAccountIncome(BigDecimal.ZERO);            //收入资金变动金额
//        journalUser.setAccountAmountFrozen(changePlan.getChangeAmount());   //冻结资金变动收入
//        journalUser.setAccountAmountWithdrawable(BigDecimal.ZERO);    //可提现资金变动收入
//        journalUser.setAccountAmountWithdrawed(changePlan.getChangeAmount());  //已提现资金变动收入
//        journalUser.setAccountAmountUndepositable(BigDecimal.ZERO);   //不可提现资金变动收入
//
//        journalUser.setAccountIncomeBefore(userAccount.getAccountIncome());      //收入变动前的金额
//        journalUser.setAccountIncomeAfterwards(userAccount.getAccountIncome());  //收入变动后的金额
//
//        journalUser.setAccountAmountFrozenBefore(userAccount.getAccountAmountFrozen());   //冻结资金变化前金额
//        journalUser.setAccountAmountFrozenAfterwards(userAccount.getAccountAmountFrozen().subtract(changePlan.getChangeAmount())); //冻结资金变化后金额
//
//        journalUser.setAccountAmountWithdrawableBefore(userAccount.getAccountAmountWithdrawable());   //可提现金额变化前金额
//        journalUser.setAccountAmountWithdrawableAfterwards(userAccount.getAccountAmountWithdrawable()); //可提现金额变化后金额
//
//        journalUser.setAccountAmountWithdrawedBefore(userAccount.getAccountAmountWithdrawed());        //已提现金额变化前金额
//        journalUser.setAccountAmountWithdrawedAfterwards(userAccount.getAccountAmountWithdrawed().add(changePlan.getChangeAmount()));    //已提现金额变化后金额
//
//        journalUser.setAccountAmountUndepositableBefore(userAccount.getAccountAmountUndepositable());     //不可提现金额变化前金额
//        journalUser.setAccountAmountUndepositableAfterwards(userAccount.getAccountAmountUndepositable()); //不可提现金额变化后金额
//
//
//        int inJournal30Size = fundAccountJournalMapper.insert(journalUser);
//        BizAssertUtils.assertOne(inJournal30Size, "添加提现流水失败");
//
//
//        //记录发起方资金方流水
//        FundAccountJournal journalSys = new FundAccountJournal(changePlan.getPlatNo());
//        journalSys.setChannelId(changePlan.getChannelId());
//        journalSys.setFundAccountChangePlanId(changePlan.getFundAccountChangePlanId());
//        journalSys.setFundAccountId(fundAccount.getFundAccountId());
//        journalSys.setJournalStatus(JournalStatus.SUCCESS);
//        journalSys.setJournalChangeValue(changePlan.getChangeAmount());
//        journalSys.setAccountJournalAcid(changePlan.getOrderId());
//
//        journalSys.setAccountMainJournalType(changePlan.getAccountMainJournalType());
//        journalSys.setAccountMainJournalTypeName(
//                AccountMainJournalType.getMainJournalTypeByCode(journalUser.getAccountMainJournalType()).getName()
//        );
//
//        journalSys.setAccountJournalType(changePlan.getFromAccountJournalType());
//        journalSys.setAccountJournalTypeName(
//                AccountJournalType.getAccountJournalTypeByFullCode(journalSys.getAccountJournalType()).getMsg()
//        );
//
//        journalSys.setAccountIncome(BigDecimal.ZERO);            //收入资金变动金额
//        journalSys.setAccountAmountFrozen(changePlan.getChangeAmount());   //冻结资金变动收入
//        journalSys.setAccountAmountWithdrawable(BigDecimal.ZERO);    //可提现资金变动收入
//        journalSys.setAccountAmountWithdrawed(changePlan.getChangeAmount());  //已提现资金变动收入
//        journalSys.setAccountAmountUndepositable(BigDecimal.ZERO);   //不可提现资金变动收入
//
//        journalSys.setAccountIncomeBefore(fundAccount.getAccountIncome());      //收入变动前的金额
//        journalSys.setAccountIncomeAfterwards(fundAccount.getAccountIncome());  //收入变动后的金额
//
//        journalSys.setAccountAmountFrozenBefore(fundAccount.getAccountAmountFrozen());   //冻结资金变化前金额
//        journalSys.setAccountAmountFrozenAfterwards(fundAccount.getAccountAmountFrozen().subtract(changePlan.getChangeAmount())); //冻结资金变化后金额
//
//        journalSys.setAccountAmountWithdrawableBefore(fundAccount.getAccountAmountWithdrawable());   //可提现金额变化前金额
//        journalSys.setAccountAmountWithdrawableAfterwards(fundAccount.getAccountAmountWithdrawable()); //可提现金额变化后金额
//
//        journalSys.setAccountAmountWithdrawedBefore(fundAccount.getAccountAmountWithdrawed());        //已提现金额变化前金额
//        journalSys.setAccountAmountWithdrawedAfterwards(fundAccount.getAccountAmountWithdrawed().add(changePlan.getChangeAmount()));    //已提现金额变化后金额
//
//        journalSys.setAccountAmountUndepositableBefore(fundAccount.getAccountAmountUndepositable());     //不可提现金额变化前金额
//        journalSys.setAccountAmountUndepositableAfterwards(fundAccount.getAccountAmountUndepositable()); //不可提现金额变化后金额
//
//        int inJournalSysSize = fundAccountJournalMapper.insert(journalSys);
//        BizAssertUtils.assertOne(inJournalSysSize, "添加提现流水失败");
//
//    }
}
